#include "Rocket.h"
#include "controller/MoveController/Box2dMoveController/Box2dMoveController.h"
#include "controller/MoveController/SimpleMoveController/SimpleMoveController.h"
#include "global/GlobalDefine.h"

Rocket::Rocket(){
	m_moveController = NULL;
}

Rocket::~Rocket(){
}

bool Rocket::init(){
	bool bRet = false;
	do{
		CC_BREAK_IF(!Entity::init());

		//m_moveController = Box2dMoveController::create(this);
		//m_moveController = SimpleMoveController::create(this);

		//this->addChild(m_moveController);

		bRet = true;
	}while(0);

	return bRet;
}

void Rocket::moveByTouch(float moveLen){
	m_moveController->moveByTouch(moveLen);
}

CCRect Rocket::boundBox(){
	if(getSprite() == NULL){
		return CCRect(0,0,0,0);
	}

	CCPoint pos = this->getPosition();
	CCSize size = getSprite()->getContentSize();
	size.width = size.width * PERCENT_CRASH_rocket;
	size.height = size.height * PERCENT_CRASH_rocket;

	return CCRect(pos.x - size.width/2, pos.y - size.height/2, size.width, size.height);
}

void Rocket::setMoveController(BaseMoveController* moveController)
{
	m_moveController = moveController;
	this->addChild(m_moveController);
}
